<!DOCTYPE html>
<html lang="ch-CN">
<head>
    <meta charset="UTF-8">
    <title>方法</title>
</head>
<style>
    body {
        width: 100%;
        height: 100vh;
        background-color: wheat;
        font-size: 30px;
        text-decoration: none;
        font-family: "华文楷体";
    }
</style>
<script>
    let obj = {
        name: "小红",
        age: "21",
        gender: "女",
        // 定义的sayName方法
        sayName: function () {
            document.write("姓名："+this.name+"<br>性别："+this.gender);
        }
    }
    // 调用obj对象中的sayName方法
    obj.sayName();
</script>
<body>
</body>
</html>